﻿from pycad.system import *
from pycad.runtime import *

@command()
def mymsg():
    from ctypes import windll
    windll.user32.MessageBoxW(0, "Great", "Hello World", 0)

@command()
def showwpf():
    from pytest.forms.WpfTestForm import WpfTestForm
    acap.Application.ShowModalDialog(WpfTestForm())

@command()
def showfrm():
    from pytest.forms.TForm import TForm
    acap.Application.ShowModalDialog(TForm())

@panel('575123da-2ca8-44a8-b57f-61eb64f5d050', 'testpanel')
class showpanel(object):
    text = '测试面板'
    dockside = acws.DockSides.Right
    def __init__(self, ps):
        from pytest.forms.TPanel import TPanel
        from System.Drawing import Size
        ps.Style = \
            acws.PaletteSetStyles.NameEditable | \
            acws.PaletteSetStyles.ShowCloseButton | \
            acws.PaletteSetStyles.Notify
        ps.DockEnabled = acws.DockSides.Left | acws.DockSides.Right
        ps.MinimumSize = Size(320, 320)
        ps.Add("P1", TPanel())
    def __docking__(self, ps):
        from System.Drawing import Size
        ps.Size = Size(320, 320)
        #可以设置固定的dock方式
        #self.dock = acws.DockSides.None
    def __docked__(self, ps):
        print 'hello world'
        
